// pages/writeMsg/writeMsg.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    otherInstructions : "",
    leaveMessage : "",
  },
  sendMsg: function(e){
    // var sendData = "?otherInstructions" + this.data.otherInstructions;
    // sendData += "&leaveMessage" + this.data.leaveMessage;
    // console.log(sendData);
    const that = this.data;
    var standerMsg = {
      otherInstructions : that.otherInstructions,
      leaveMessage : that.leaveMessage
    }
    wx.setStorageSync('standerMsg', standerMsg);
    wx.switchTab({
      url: '../../pages/index/index',
      success : function(){
        console.log("send OK");
      },
      fail: function(e){
        console.log(e);
        console.log("send fail");
      }

    })
  },
  setValue: function (e) {
    this.setData({
      [e.currentTarget.dataset.name]: e.detail.value
    })
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options);
    var standerSorce = options.standerMsg;
    if(standerSorce && "" !== standerSorce && "undefined" != standerSorce){
      standerSorce = JSON.parse(standerSorce);
      this.setData({
        otherInstructions : standerSorce.otherInstructions,
        leaveMessage : standerSorce.leaveMessage
      })
    }
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})